package com.googlecode.lightest.core

import org.testng.ITestResult
import org.testng.internal.TestNGMethod

/**
 * Represents a single, possibly-future, TestNG test method invocation.
 */
class TestInstance {
	String suiteName
    String testName
    String className
    String methodName
    String methodSignature

    TestInstance(String suiteName, String testName, String className,
        String methodName, String methodSignature)
    {
        this.suiteName = suiteName
        this.testName = testName
        this.className = className
        this.methodName = methodName
        this.methodSignature = methodSignature
    }

    TestInstance(TestInstance other) {
        this.suiteName = other.suiteName
        this.testName = other.testName
        this.className = other.className
        this.methodName = other.methodName
        this.methodSignature = other.methodSignature
    }

    @Override
    String toString() {
        def fields = [
            suiteName,
            testName,
            className,
            methodName,
            methodSignature
        ]
        
        return '[' + fields.join(':') + ']'
    }

    @Override
    boolean equals(Object obj) {
        return (obj instanceof TestInstance && obj.toString() == toString())
    }

    @Override
    int hashCode() {
        return toString().hashCode()
    }
}

